-
Notifications
You must be signed in to change notification settings - Fork 589
Rename _isQUOTEMETA to isQUOTEMETA_ #23555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Dumb question, since I've never seen a written (.pod) C code style document for the Perl VM, I got a question, what suffix or prefix is used for an exported linker recognized C function, but that C function is 100% private, its private from CPAN, and its private from 95% of other FOSS C projects prefix or suffix the C linker symbol with It would be nice to know if Perl API best practice is _x _p or _ to do a C linker symbol ABI change. Nothing in Perlhacktips perlintern or perlguts has any guidance for best practices. the chance of If you mess around with This ^^^^^ caused actual SEGVs in WinPerl until 5.13 when I added the DATA token to the .def file on this line. https://github.com/Perl/perl5/blob/blead/makedef.pl#L1261 There (was in 2025) is "production CPAN module code" that demands ISO C compliance for unprototyped C functions feature!!!! Who needs Why should my PC waste an extra 30 seconds or 2 minutes compiling P5P's BLOATWARE .h files? None of that is needed to make a proper Result of messing with
I think the 5.10 or 5.12 Win32 "DATA" token crashes were because die() and warn() used have linker names of "die" and "warn" and someone has a `extern const char die[] = "fatal error: %d"; line in their .xs file. I dont think this category of SEGVs/ABI flaws with P5P's |
I dont see any problem with the name change itself, I think the _ on the right looks better, my only trivial concern is the commit message is claiming its a dire technical engineering reason, that nobody has reproduced since the early 1980s. While in fact this is a code readability/style/prettyness/future maintenance improvement. Its not an engineering problem. My ABI discussions above were how intentionally normal non-insane code (freelancer temp gig software projects) were able to once in a blue moon trigger the 0 _1 __2 or ___3 linker phase/TU/C lexer phase disasters, and it always involved never reading the man page for the compiler on your hard drive. A made a POC branch some months ago, not-abusing but using this 0 _1 __2 or ___3 linker phase/parser phase confusion, to redesign WinPerl's horrifically slow Perl_get_context() function, into pthread_t mainline Perl_get_context() symbol (it a PLT/GOT function that is 5 CPU instructions long, WinPerl's is 450 CPU instructions since 1996-2025), or straight up the TLS data is a 100% legit C lang semi-global data variable using secret GAS in a secret .h file by certain builds of perl by certain entities for certain linux distros. The good using of this ABI C linker insanity, is to completely optimize out the Win32 Symbol table rules (cough cough 3 memory reads through the PLT/GOT), so CPAN .dlls can access perl5xx.dll's TLS offset true global variable backed by
Sadly this optimization discriminates against WinPerl on AMD64 builds, or WinPerl on i386 builds because of ABI/C name mangling rules between the 2 different CPUs. I forgot which. I need to insert a lower 7 bit ASCII |
TLDR: 20 or 25 years ago NIS JHI or Nick Clark immunized for the next 1000 years |
It is not dire, and it appears you misunderstand why it is being done. The C standard says that symbol names that begin with an underscore followed by an uppercase letter in file scope are reserved for the C implementation's use (Section 7.1.3 of C99). The blead name violates this. The compiler could croak on this, but none I'm aware of do. It's not a problem unless we stumble upon an identifier that they actually use. So we are gradually converting the illegal ones we have invented to legal ones. That's all this commit does. It has nothing to do with linking. |
Why have an underscore at all? |
To make someone think twice about using it, being undocumented hasn't stopped people in the past from using things, and then they put up a stink should it change. I don't want to have to support this publicly, so the underscore is a bit of extra insurance |
Why not just guard it with PERL_CORE? |
The former is undefined behavior in C in some situations. The rules are detailed in "Choosing legal symbol names" in perlhacktips This commit omits the underscore and makes the macro available only to the core and extensions. I think I didn't know about PERL_CORE when I created this macro, so used the leading underscore to discourage its use from anyone who stumbled upon its existence. The reason not to make it public was my uncertainty about if it was the correct thing to do; my not expecting that it would be useful outside of core; and the extra work needed to make it a polished interface. I think now that if someone requested it be made public, that could safely be done.
Changed as @tonycoz suggested |
The former is undefined behavior in C in some situations.